package com.ruoyi.project.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.domain.GyLooming;
import com.ruoyi.project.service.IGyLoomingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 工艺设计穿综筘表Controller
 * 
 * @author xiangjun
 * @date 2021-12-14
 */
@RestController
@RequestMapping("/gongyi/gy_looming")
public class GyLoomingController extends BaseController
{
    @Autowired
    private IGyLoomingService gyLoomingService;

    /**
     * 查询工艺设计穿综筘表列表
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:list')")
    @GetMapping("/list")
    public TableDataInfo list(GyLooming gyLooming)
    {
        startPage();
        List<GyLooming> list = gyLoomingService.selectGyLoomingList(gyLooming);
        return getDataTable(list);
    }

    /**
     * 导出工艺设计穿综筘表列表
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:export')")
    @Log(title = "工艺设计穿综筘表", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GyLooming gyLooming)
    {
        List<GyLooming> list = gyLoomingService.selectGyLoomingList(gyLooming);
        ExcelUtil<GyLooming> util = new ExcelUtil<GyLooming>(GyLooming.class);
        return util.exportExcel(list, "工艺设计穿综筘表数据");
    }

    /**
     * 获取工艺设计穿综筘表详细信息
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gyLoomingService.selectGyLoomingById(id));
    }

    /**
     * 新增工艺设计穿综筘表
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:add')")
    @Log(title = "工艺设计穿综筘表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GyLooming gyLooming)
    {
        return toAjax(gyLoomingService.insertGyLooming(gyLooming));
    }

    /**
     * 修改工艺设计穿综筘表
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:edit')")
    @Log(title = "工艺设计穿综筘表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GyLooming gyLooming)
    {
        return toAjax(gyLoomingService.updateGyLooming(gyLooming));
    }

    /**
     * 删除工艺设计穿综筘表
     */
    @PreAuthorize("@ss.hasPermi('gongyi:gy_looming:remove')")
    @Log(title = "工艺设计穿综筘表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gyLoomingService.deleteGyLoomingByIds(ids));
    }
}
